package com.example.g2daylx2.video

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.example.lib_base.net.entity.VideoEntityResult
import com.example.lib_base.net.mvvm.BaseViewModel
import kotlinx.coroutines.launch

class VideoViewModel:com.example.g2daylx2.BaseViewModel() {
    val videoSuccess = MutableLiveData<VideoEntityResult>()
    val videoFail = MutableLiveData<String>()
    fun video(limit:Int,page:Int){
        viewModelScope.launch {
            try {
                videoSuccess.value = apiService.video(limit,page)
            }catch (e:Exception){
                videoFail.value = e.message
            }
        }
    }
}